export default class Bus {
	constructor() {
		this.queue = {}
	}
	on(name, callback) {
		if (!this.queue[name]) {
			this.queue[name] = []
		}
		this.queue[name].push(callback)
	}
	emit(name, data) {
		const queue = this.queue[name]
		if (queue) {
			queue.forEach(item => item(data))
		}
	}
}

const bus = new Bus()
bus.on('zw', data => {
	console.log(data, 222222)
})

bus.emit('zw', 18)
